package com.xiaowan.user.controller;

import com.xiaowan.apis.user.PersonalInfoControllerApi;
import com.xiaowan.model.common.dtos.ResponseResult;
import com.xiaowan.model.user.PersonalInfo;
import com.xiaowan.user.service.PersonalInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 实现功能：个人信息
 *
 * @author 作者[admin]
 * @version 1.0.00 2023-04-07 12:06
 */
@RestController
@RequestMapping("/personal")
public class PersonalInfoController implements PersonalInfoControllerApi {
    @Autowired
    private PersonalInfoService personalInfoService;

    /**
     * 完善个人信息
     * @param personalInfo
     */
    @PostMapping("/perfectMessage")
    public ResponseResult addMessage(@RequestBody PersonalInfo personalInfo){
        return  personalInfoService.addMessage(personalInfo);
    }

    /**
     * 筛选用户的个人信息
     * @return
     */
    @GetMapping("/findUserById/{id}")
    public ResponseResult findUserById(@PathVariable Integer id){
        //应该从登录信息中获取
        return personalInfoService.findUserById(id);
    }

    /**
     * 修改个人信息
     * @param personalInfo
     */
    @PostMapping("/updatePersonalInfo")
    public ResponseResult updatePersonalInfo(@RequestBody PersonalInfo personalInfo){
        return personalInfoService.updatePersonalInfo(personalInfo);
    }
}
